
import os
import re

#print os.walk('.')

INPUTFOLDER = 'tests/XYZ'
for root, dirs, files in os.walk(INPUTFOLDER):
    BASEFOLDER = os.path.split(INPUTFOLDER)[-1]
    for fileName in files:
        #print os.path.join(root,fileName)
        print base
        print root
        RELATIVEFOLDER = re.sub('^'+INPUTFOLDER, BASEFOLDER, root)
        print os.path.join(RELATIVEFOLDER,fileName)
        print 'ROOT:%s , DIRS:%s, FILENAME:%s' % (root, dirs, fileName)
